// API 路径配置
export const API_PATHS = {
  // 用户认证
  LOGIN: '/api/user/login',
  REGISTER: '/api/user/register',
  LOGOUT: '/api/user/logout',
  
  // 用户信息
  USER_PROFILE: '/api/user/profile',
  UPDATE_PROFILE: '/api/user/profile',
  UPDATE_PASSWORD: '/user/password',
  RESET_PASSWORD: '/user/reset-password',
  USER_INFO: '/api/user/profile',
  
  // 仪表盘相关
  DASHBOARD: '/api/dashboard',
  DAILY_NUTRITION: '/api/dashboard/nutrition',
  WEIGHT_TREND: '/api/dashboard/weight',
  GOAL_PROGRESS: '/api/dashboard/goal',
  RECENT_MEALS: '/api/dashboard/meals',
  
  // 目标相关
  GET_GOAL: '/user/goal',
  SET_GOAL: '/user/goal',
  UPDATE_GOAL: '/user/goal/{id}',
  
  // 膳食相关
  MEAL_RECORDS: '/user/meals',
  MEAL_TEMPLATES: '/user/meal-templates',
  
  // 其他
  EXPORT_DATA: '/user/export',
  DELETE_ACCOUNT: '/user/account',
  RECOMMENDED_PLAN: '/api/meal-plan/recommend',
  
  // 食谱相关
  RECIPES: '/api/user/recipes',
  RECIPE_DETAIL: '/api/recipes/{id}',
  RECIPE_CATEGORIES: '/api/recipes/categories',
  RECIPE_FAVORITES: '/api/user/favorites',
  
  // 食物相关
  FOOD_SEARCH: '/api/food/search',
  FOOD_DETAIL: '/api/food/{id}',
  FOOD_RECOMMENDATION: '/api/food/recommendation',
  FOOD_RECOMMENDATION_MEAL: '/api/food/recommendation/meal-type/{type}',
  FOOD_RECOMMENDATION_NUTRITION: '/api/food/recommendation/nutrition',
  FOOD_RECOMMENDATION_PREFERENCE: '/api/food/recommendation/preference',
  FOOD_RECOMMENDATION_GOAL: '/api/food/recommendation/goal',
  FOOD_CATEGORIES: '/api/food/categories'
}

// 获取 API 路径
export function getApiPath(path, params = {}) {
  let url = API_PATHS[path]
  if (!url) return path
  
  // 替换路径参数
  Object.keys(params).forEach(key => {
    url = url.replace(`{${key}}`, params[key])
  })
  
  return url
} 